import React, {PureComponent} from 'react';
import './style.css'
import store from '../store'
import {NUMBER_TYPE} from "../constants/Constants";

class Left extends PureComponent {

    changeNumber = function (number) {
        store.dispatch({
            type: NUMBER_TYPE,
            value: store.getState()[NUMBER_TYPE] + number
        })
    }

    render() {
        const butNumber = [1, 2, 3, 10]
        return (
            <div className='right'>
                <h3>减少</h3>
                {butNumber.map((item, index) => (
                    <div key={index}><button onClick={e => this.changeNumber(item)}>{`+${item}`}</button></div>
                ))}
            </div>
        );
    }
}

Left.propTypes = {};

export default Left;